﻿//Write an expression that checks if given positive 
//integer number n (n ≤ 100) is prime. E.g. 37 is prime.

using System;

namespace PrimeInt
{
    class IsPrime
    {
        static void Main()
        {
            Console.Write("Please enter n<=100: ");
            byte n = byte.Parse(Console.ReadLine());

            bool isPrime = true;

            if (n == 0)
            {
                isPrime = false;
            }
            else if (n == 1)
            {
                isPrime = true;
            }
            else if (n <= 100)
            {
                for (byte i = 2; i < n; i++)
                {
                    if (n % i == 0)
                    {
                        isPrime = false;
                        break;
                    }
                }
            }
            else
            {
                Console.WriteLine("Your number '{0}' is > 100", n);
                Environment.Exit(1);
            }

            if (isPrime == true)
            {
                Console.WriteLine("Congrats. Your number '{0}' is prime!", n);
            }
            else
            {
                Console.WriteLine("Your number '{0}' is not prime!", n);
            }
        }
    }
}